package com.talkingdata.hadoop.util

import com.fasterxml.jackson.databind.{JsonNode, ObjectMapper}

import scala.io.Source

case class LoadUrl() {
	def getOneMetric(url : String,metric :String ): JsonNode = {
		val urlinfo = Source.fromURL(url, "UTF-8").mkString
		val om = new ObjectMapper
		om.readTree(urlinfo).path("beans").get(0).get(metric)
	}
	def getOneMetricOnYarn (url : String,metric :String): JsonNode = {
		val urlinfo = Source.fromURL(url, "UTF-8").mkString
		val om = new ObjectMapper
		om.readTree(urlinfo).path(metric)
	}
}
